<template>
  <div id="app">
    <router-view/>
  </div>
</template>


<script>
  import jwt_decode from "jwt-decode";

  export default {
    name: "App",
    created() {


      document.title = "课室报障管理系统";    //设置当前页面的title内容


      if (localStorage.eleToken) {
        const decoded = jwt_decode(localStorage.eleToken)
        // token 存储到vuex中
        this.$store.dispatch("setAuthenticated", !this.isEmpty(decoded))
        this.$store.dispatch("setUser", decoded)
      }
    },
    methods: {
      isEmpty(value) {
        return (
          value === undefined || value === null || (typeof value === "object" && Object.keys(value).length === 0) ||
          (typeof value === "string" && value.trim().length === 0)
        )
      }
    }
  }
</script>

<style>
  @import "assets/normalize.css";

  #app {
    height: 100%;
    min-width: 1450px;
    background-color: white;
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  }


</style>
